﻿@{
    ViewData["Title"] = "提升机十字口配置";
    Layout = "_Edit";
}
<article class="page-container">
    <form action="" method="post" class="form form-horizontal" id="form-add">
        @* <input type="hidden" class="input-text" value="@Model.EquipmentCode" id="id" name="id">
        <div class="row cl">
        <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>设备编号：</label>
        <div class="formControls col-xs-8 col-sm-9">
        <input type="text" class="input-text" value="@Model.EquipmentCode" placeholder="" id="EquipmentCode" name="EquipmentCode">
        </div>
        </div>*@
        <input type="hidden" class="input-text" value="@Model.ID" id="id" name="id">

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>十字口设备号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="@Model.CrossroadEquipmentCode" placeholder="" id="CrossroadEquipmentCode" name="CrossroadEquipmentCode">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>提升机设备号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="@Model.ElevatorCode" placeholder="" id="ElevatorCode" name="ElevatorCode">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>后续十字口编号（，隔开）：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="@Model.NextElevatorCodes" placeholder="" id="NextElevatorCodes" name="NextElevatorCodes">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>提升机入口设备号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="@Model.ElevatorPUCode" placeholder="" id="ElevatorPUCode" name="ElevatorPUCode">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>提升机出口设备号（-隔开）：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="@Model.ElevatorDOCodes" placeholder="" id="ElevatorDOCodes" name="ElevatorDOCodes">
            </div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>可去往目标设备号：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" value="@Model.CanToEquipments" placeholder="" id="CanToEquipments" name="CanToEquipments">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>是否启用：</label>
            <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                <div class="radio-box">
                    @if (Model.IsEnable)
                    {
                        <input name="IsEnable" type="radio" id="IsEnable-true" value="1" checked>
                    }
                    else
                    {
                        <input name="IsEnable" type="radio" id="IsEnable-true" value="1">

                    }
                    <label for="IsEnable-true">是</label>
                </div>
                <div class="radio-box">
                    @if (Model.IsEnable)
                    {
                        <input name="IsEnable" type="radio" id="IsEnable-false" value="0">
                    }
                    else
                    {
                        <input name="IsEnable" type="radio" id="IsEnable-false" value="0" checked>
                    }
                    <label for="IsEnable-false">否</label>
                </div>
            </div>
        </div>

        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" type="button" onclick="operate()" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>
</article>

@section javascript {

    <script>
        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });
        function operate() {


            var CrossroadEquipmentCode = $("#CrossroadEquipmentCode").val();
            if (CrossroadEquipmentCode == null || CrossroadEquipmentCode == "") {
                popupAlert('请输入十字口设备号', 2, function (data) { layer.close(data); });
                return;
            }

            var ElevatorCode = $("#ElevatorCode").val();
            if (ElevatorCode == null || ElevatorCode == "") {
                popupAlert('请输入提升机设备号', 2, function (data) { layer.close(data); });
                return;
            }

            var NextElevatorCodes = $("#NextElevatorCodes").val();
            if (NextElevatorCodes == null || NextElevatorCodes == "") {
                popupAlert('请输入后续提升机十字口设备号，没有写0', 2, function (data) { layer.close(data); });
                return;
            }
            var ElevatorPUCode = $("#ElevatorPUCode").val();
            if (ElevatorPUCode == null || ElevatorPUCode == "") {
                popupAlert('请输入提升机入口设备编号', 2, function (data) { layer.close(data); });
                return;
            }
            var ElevatorDOCodes = $("#ElevatorDOCodes").val();
            if (ElevatorDOCodes == null || ElevatorDOCodes == "") {
                popupAlert('请输入提升机出口设备号', 2, function (data) { layer.close(data); });
                return;
            }
            var CanToEquipments = $("#CanToEquipments").val();
            if (CanToEquipments == null || CanToEquipments == "") {
                popupAlert('请输入可去目标设备号', 2, function (data) { layer.close(data); });
                return;
            }
            SubmitFormForAjax("/elevatorMasterInfo/OperateElevatorMasterInfo", $("#form-add").serialize(), function (data) {
                if (data.result) {
                    popupAlert('提交成功', 1, function () { closePageLayer(true); });
                } else {
                    popupAlert(data.message, 2, function (data) { layer.close(data); });
                }
            }, true);
        }
    </script>
}